<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
 <meta charset="utf-8">
 <title>发起督办</title>
 <meta name="renderer" content="webkit">
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
 <link rel="stylesheet" th:href="@{../layui/css/layui.css}" media="all">
<link href="favicon.ico" rel="shortcut icon">
</head>
<script th:src="@{../layui/layui.js}" charset="utf-8"></script>
<body>
<form class="layui-form layui-form-pane1" action="/superVision/toAddSuperVision" method="post" lay-filter="first">	
  <div class="layui-form-item">
    <label class="layui-form-label">督办标题</label>
    <div class="layui-input-block">
      <input type="text" name="svTitle" lay-verify="title" autocomplete="off" placeholder="请输入督办标题" class="layui-input">
  </div>
  </div>
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">督办内容</label>
    <div class="layui-input-block">
      <textarea placeholder="请输入内容" class="layui-textarea" name="svContent"></textarea>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">选择发送部门</label>
    <div class="layui-input-inline">
        <select name="did" lay-filter="bumen"> 
        <option th:each="dept,userStat:${depts}" th:value="${dept?.did}" th:text="${dept?.dname}"></option>
      </select> 
    </div>
    <div class="layui-input-inline">
        <select name="did" id="did">
            <option value=""></option>
        </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">督查类型</label>
    <div class="layui-input-block">
       <select name="sid" lay-filter="aihao"> 
        <option th:each="superVisionType,userStat:${superVisionTypes}" th:value="${superVisionType.sid}" th:text="${superVisionType.sname}"></option>
      </select> 
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">签收时间</label>
  <div class="layui-inline">
	  <input type="text" name="confirmTime" class="layui-input" id="test6-3">
  </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">结束时间</label>
	  <div class="layui-inline">
		  <input type="text" name="endTime" class="layui-input" id="test6-2">
	  </div>
  </div>
    <div class="layui-form-item">
    <label class="layui-form-label">通知分管领导</label>
    <div class="layui-input-block">
      <input type="radio" name="sendLeader" value="通知" title="通知">
      <input type="radio" name="sendLeader" value="不通知" title="不通知" checked>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">设置回复次数</label>
    <div class="layui-input-block">
      <select name="replices" >
      	<option value="1">请选择</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
      </select>
    </div>
  </div>
  <input type="hidden" name="state">
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="first">发起督办</button>
      <button class="layui-btn" lay-submit lay-filter="second" formmethod="get">存为草稿</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
<script th:src="@{../layui/layui.js}" charset="utf-8"></script>
<script>

layui.use(['form'], function(data){
	  var form = layui.form;
	  var $=layui.$;
	  form.on('select(bumen)', function(data){
		    
		 
	  $.getJSON("/superVision/toGetDepts?parentId="+data.value, function(data){
				// var statusCode= 200 //规定成功的状态码，默认：0	
				//alert(data.list);
	        var optionstring = "";
	        $.each(data.list, function(i,item){
	            optionstring += "<option value=\"" + item.did + "\" >" + item.dname + "</option>";
	           // alert(optionstring);
	        }); 
	        layui.$("#did").html('<option value=""></option>' + optionstring);
	        form.render('select'); //这个很重要
	    });
	  });
	});
layui.use('laydate', function(){
  var laydate = layui.laydate;  
  //自定义背景色主题
  laydate.render({
    elem: '#test6-2' //指定元素
    ,type: 'datetime'
    ,theme: '#393D49'
    //,range: true
    ,trigger: 'click'
  });
  //自定义背景色主题
  laydate.render({
    elem: '#test6-3' //指定元素
    ,type: 'datetime'
    ,theme: '#393D49'
    //,range: true
    ,trigger: 'click'
  });
  //自定义背景色主题
  laydate.render({
    elem: '#test6-1' //指定元素
    ,type: 'datetime'
    ,theme: '#393D49'
    //,range: true
    ,trigger: 'click'
  });
  
  
});

</script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
  //日期
  laydate.render({
    elem: '#date'
  });
  laydate.render({
    elem: '#date1'
  });
  
  //创建一个编辑器
  var editIndex = layedit.build('LAY_demo_editor');
 
  //自定义验证规则
  form.verify({
    title: function(value){
      if(value.length < 5){
        return '标题至少得5个字符啊';
      }
    }
    ,pass: [
      /^[\S]{6,12}$/
      ,'密码必须6到12位，且不能出现空格'
    ]
    ,content: function(value){
      layedit.sync(editIndex);
    }
  });
  
  //监听指定开关
  form.on('switch(switchTest)', function(data){
    layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
      offset: '6px'
    });
    layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
  });
  
  //监听提交
  form.on('submit(demo1)', function(data){
    layer.alert(JSON.stringify(data.field), {
      title: '最终的提交信息'
    })
    return false;
  });
 
  //表单初始赋值
  form.val('example', {
    "username": "贤心" // "name": "value"
    ,"password": "123456"
    ,"interest": 1
    ,"like[write]": true //复选框选中状态
    ,"close": true //开关状态
    ,"sex": "女"
    ,"desc": "我爱 layui"
  })
  
  
});
</script>
</body>
</html>